<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0,viewport-fit=cover" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/vant.css">
    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
    <link rel="stylesheet" type="text/css" href="../../css/local.css" />
    <link rel="stylesheet" type="text/css" href="../../font/iconfont.css" />
    <link rel="stylesheet" href="../../script/elementui/lib/theme-chalk/index.css?t=1">
    <link href="../../script/elementui/vue-element-table.css" rel="stylesheet" />
    <script type="text/javascript" src="../../script/jquery.js"></script>
    <script type="text/javascript" src="../../script/layer/layer.js"></script>
    <script type="text/javascript" src="../../script/vue.min.js"></script>
    <script type="text/javascript" src="../../script/vant.min.js"></script>
    <script type="text/javascript" src="../../script/fastclick.js"></script>
    <script src="../../script/elementui/lib/index.js?t=1"></script>
    <script src="../../script/elementui/vue-element-bigdata-table.min.js?t=4"></script>
    <script type="text/javascript" src="../../script/base.js"></script>
    <script type="text/javascript" src="../../script/JSLINQ.js"></script>
    <style>
        body {
            zoom: 0.9;
        }

        .toolbar {
            position: relative;
            height: 54px !important;
        }

        .searchPopover {
            position: absolute;
            top: 0px;
            left: 0px;
            width: 75px;
            height: 50px;
            opacity: 0;
        }

        .van-popover {
            width: 100% !important;
            left: 0px !important;
        }

        .part {
            padding: 15px 15px 0 15px;
        }

        .part .pf {
            border-radius: 6px;
            box-shadow: 0px 1px 5px rgb(200, 198, 198);
            background-color: #fff;
            overflow: hidden;
            position: relative;
        }

        .part .pf1 {
            background-color: #fff;
            overflow: hidden;
            position: relative;
        }

        .pftitle {
            line-height: 40px;
        }

        .van-badge {
            margin: 10px 10px;
            background-color: #1989fa;
            color: #fff;
            display: block;
            width: 22px;
            padding: 3px;
            float: left;
            vertical-align: middle;
        }

        .van-loading {
            position: fixed;
            top: 50%;
            z-index: 99999;
            left: calc(50% - 20px);
        }

        .main {
            display: flex;
            overflow: auto;
            flex-grow: 1;
            height: 100%;
            width: 100%;
            flex-direction: column;
        }

        .provalStatus {
            position: absolute;
            top: 20px;
            right: 0px;
            z-index: 9999;
            transform: rotate(30deg);
        }

        .van-cell {
            padding: 5px 16px !important;
        }

        .JYRWCbutton {
            bottom: 0;
            position: fixed;
            z-index: 1;
            width: 100%;
            padding: 5px 10px;
            right: 0px
        }

        .big-checkbox {
            transform: scale(1.3);
            /* margin: 10px; */
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="box">
            <van-nav-bar-main :title="titleName" left-arrow @click-left="onClickLeft">
                <div slot="right">
                    <span>
                        <van-icon name="plus" size="18px" @click="insertNew()"></van-icon>
                    </span>
                </div>
            </van-nav-bar-main>
            <div class="toolbar">
                <van-search v-model="queryConditions[titleCol.colName]" right-icon="search" label="筛选"
                    left-icon="apps-o" :placeholder="'请输入搜索'+titleCol.colDesc" @search="searchList"></van-search>
                <van-popover v-model="showPopover" trigger="click" placement="bottom" :offset="[0,-22]" overlay="true">
                    <van-form>
                        <div v-for="row in queryColumns">
                            <van-field v-if="row.colType==1" v-model="queryConditions[row.colName]"
                                :label="row.colDesc"></van-field>
                            <van-field v-if="row.colType==2 && row.selDetail.type==1"
                                v-model="queryConditions[row.colName+'_show']" is-link :label="row.colDesc" readonly
                                @click="clickSelectPicker(row)"></van-field>
                            <van-field v-if="row.colType==3" v-model="queryConditions[row.colName]" :label="row.colDesc"
                                readonly :formatter="formatterDate" @click="clickDatePicker(row)"></van-field>
                            <van-field type="number" v-if="row.colType==4" v-model="queryConditions[row.colName]"
                                :label="row.colDesc" readonly></van-field>
                        </div>
                        <van-button type="info" block @click="searchList">查询</van-button>
                    </van-form>
                    <template #reference>
                        <div class="searchPopover"></div>
                    </template>
                </van-popover>
            </div>
            <div class="main">
                <!-- <van-tree-select height="55vw" :items="items" :main-active-index.sync="active">
                    <template #content>
                      <van-image
                        v-if="active === 0"
                        src="https://img01.yzcdn.cn/vant/apple-1.jpg"
                      />
                      <van-image
                        v-if="active === 1"
                        src="https://img01.yzcdn.cn/vant/apple-2.jpg"
                      />
                    </template>
                </van-tree-select> -->
                <!-- <div style="width: 100%;" class="part">

                    <div class="pf1">
                        <input type="checkbox" id="selectAll" v-model="AllListShow" @change="CLicktoggleAll"
                            v-show='JYRWCListShow' v-if='api.pageParam.titleName == "检验任务池" ' class="big-checkbox">
                        <label for="selectAll" v-show='JYRWCListShow'
                            v-if='api.pageParam.titleName == "检验任务池" '>全选/不选</label>
                    </div>

                </div> -->

                <div class="part">
                    <van-list v-model="showListLoading" :finished="finished" finished-text="没有更多了"
                        :immediate-check="false" @load="handleSizeChange">
                        <div class="pf" v-for="item in tableData" @click="clickItem(item)">
                            <div class="pftitle">
                                <!-- //顺序 -->
                                <div style="display: flex;align-items: center;width: 100%;">
                                    <div class="van-badge">
                                        {{ item.objNo }}
                                    </div>
                                    {{ item[titleCol.colName] }}
                                </div>
                            </div>
                            <van-field :label="col.colDesc" v-show='col.colDesc!="工艺顺序"' v-model="item[col.colName]"
                                readonly v-for="col in columns" v-if="!col.isHidden && !col.isTitle"></van-field>


                            <!-- <van-checkbox-group v-model="AddJYRWCList" @change='AddJYRWC_List' ref="checkboxGroup">
                            <div class="pf" v-for="item in tableData">
                                <div class="pftitle">
                                    <div style="display: flex;align-items: center;width: 100%;">
                                        <van-checkbox :name="item.ZJID" shape="square" @change='changeZJID(item.ZJID)'
                                            v-if='api.pageParam.titleName == "检验任务池" ' v-show='JYRWCListShow'>
                                        </van-checkbox>
                                        <div class="van-badge">
                                            {{ item.objNo }}
                                        </div>
                                        {{ item[titleCol.colName] }}
                                    </div>
                                </div>
                        </van-checkbox-group>
                        <van-field :label="col.colDesc" v-show='col.colDesc!="工艺顺序"' v-model="item[col.colName]"
                            @click="clickItem(item)" readonly v-for="col in columns"
                            v-if="!col.isHidden && !col.isTitle"></van-field> -->

                            <!-- <van-field :label="col.colDesc" v-model="item[col.colName]" v-if='item.EmplID'
                            @click="clickItem(item)" readonly v-for="col in columns"
                            v-if="!col.isHidden && !col.isTitle"></van-field> -->

                            <!-- <van-field :label="col.colDesc" v-model="item[col.colName]" v-else readonly
                            v-for="col in columns" v-if="!col.isHidden && !col.isTitle"></van-field>-->

                            <div class="provalStatus" v-if="item.Approve && titleName != '不合格评审'">
                                <img v-if="ShowReady" src="../../image/sh.jpg" width="100"></img>
                            </div>

                            <div class="provalStatus" v-if="item.Status3 && titleName == '不合格评审'">
                                <img v-if="item.ReviewStatus == '运营总监已审批'" src="../../image/agree.png"
                                    width="120"></img>
                                <img v-if="item.Status3 == '已拒绝'" src="../../image/reject.png" width="120"></img>
                            </div>
                        </div>
                    </van-list>

                </div>
                <!-- 领用 -->
                <!-- <div class="JYRWCbutton" v-if='api.pageParam.titleName == "检验任务池" ' v-show='JYRWCListShow'>
                <div style="float:right;width:20%;">
                    <van-button round block type="info" native-type="submit" @click="submit">领用</van-button>
                </div>
            </div> -->
            </div>

        </div>
        <van-loading color="#0094ff" v-show="isLoading">加载中...</van-loading>
        <!-- <van-popup v-model="showDatePicker" position="bottom">
            <van-datetime-picker type="date" v-model="curDate" @confirm="onDatePickerConfirm" @cancel="onDatePickerCancel" />
        </van-popup> -->
        <van-calendar v-model="showDatePicker" type="range" @confirm="onDatePickerConfirm" @cancel="onDatePickerCancel"
            color="#0094ff" :show-title="false" :allow-same-day="true" :min-date='minDate'>
        </van-calendar>
        <van-popup v-model="showSelectPicker" position="bottom">
            <van-picker show-toolbar :columns="curSelectDataSource" @confirm="onSelectPickerConfirm"
                @cancel="onSelectPickerCancel"></van-picker>
        </van-popup>

    </div>
</body>
<style>
    .van-field__left-icon {
        line-height: 20px;
    }
</style>
<script type="text/javascript">
    var vm;

    apiready = function () {
        api.addEventListener({
            name: 'refresh'
        }, function (ret, err) {
            vm.searchList();
        });

        vm = new Vue({
            el: '#app',
            data: {
                titleName: api.pageParam.titleName,
                isLoading: false,
                value: '',
                showPopover: false,
                //列表状态
                showListLoading: false,
                finished: false,
                //查询组件
                showDatePicker: false,
                curDate: '',
                curDateObj: '',
                showSelectPicker: false,
                curSelect: '',
                curSelectObj: '',
                curSelectDataSource: [],
                columns: [],
                workList: [],
                crudList: [],
                params: [],
                titleCol: {},
                queryColumns: [],
                queryConditions: {},
                paging: {
                    pageSize: 10,
                    pageIndex: 1,
                    totalCount: 0
                },
                tableData: [],
                minDate: new Date('2018-1-1'),
                keyName: '',
                keyValue: '',
                ShowReady: true, // 是否展示已审核
                JYRWCList: [],
                AddJYRWCList: [],
                JYRWCListShow: true,
                AllListShow: false
            },
            created: function () {
                //初始化
                var that = this;
                // console.log(api.pageParam.titleName);
                if (api.pageParam.titleName == '检验员确认报废数量' || api.pageParam.titleName == '已审核检验员确认报废数量') {
                    that.ShowReady = false
                }
                that.initConfig(api.pageParam.titleName);
                // if (api.pageParam.titleName == '检验任务池') {
                //     that.JYRWC_List()
                // }
            },
            methods: {
                changeZJID(val) {
                    var that = this
                    console.log('311', JSON.stringify(val))
                    api.alert({
                        title: '提示!',
                        msg: val,
                    }, function (alertRet, alerterr) {

                    });
                    api.alert({
                        title: 'list!',
                        msg: list,
                    }, function (alertRet, alerterr) {

                    });
                    api.alert({
                        title: 'that.AddJYRWCList!',
                        msg: that.AddJYRWCList,
                    }, function (alertRet, alerterr) {

                    });
                    var list = that.tableData.map(item => item.ZJID)
                    if (list.length == that.AddJYRWCList.length) {
                        that.AllListShow = true
                        console.log('333true', JSON.stringify(that.AllListShow))

                    }
                    else {
                        that.AllListShow = false
                        console.log('333fasle', JSON.stringify(that.AllListShow))

                    }
                },
                CLicktoggleAll() {
                    var that = this
                    var list = that.tableData.map(item => item.ZJID)
                    // this.$refs.checkboxGroup.toggleAll();
                    if (that.AllListShow) {
                        that.AddJYRWCList = list
                    } else {
                        that.AddJYRWCList = []
                    }
                },
                submit() {
                    var that = this
                    if (that.AddJYRWCList.length > 0) {
                        var AddJYRWCList = that.AddJYRWCList.join(',')
                        console.log('AddJYRWCList', JSON.stringify(AddJYRWCList))
                        APP.ajax('APP_JYRWC_LY', { ZJID: AddJYRWCList, UserID: APP.getUserInfo().UserID }, function (res) {
                            console.log('263263263res', JSON.stringify(res))
                            if (res.ds[0].status == 200) {
                                api.toast({
                                    msg: res.ds[0].msg
                                })
                                APP.ajax('APP_UPDATE_JYRWC_YLY', { ZJID: AddJYRWCList }, function (res) {
                                    api.toast({
                                        msg: res.ds[0].msg
                                    })
                                    that.tableData = that.tableData.filter(obj => that.AddJYRWCList.includes(obj.ZJID))
                                    that.JYRWCListShow = false
                                    // console.log(that.tableData)
                                    // vm.handleSizeChange();

                                })
                            }
                        })
                    } else {
                        api.toast({
                            msg: '请先勾选'
                        })
                    }

                },
                JYRWC_List() {
                    var that = this
                    APP.ajax('APP_JYRWC_List', {
                        UserID: APP.getUserInfo().UserID
                    }, function (res) {
                        that.JYRWCList = res.ds
                        console.log('263263263res', JSON.stringify(res))
                    })
                },
                AddJYRWC_List() {
                    var that = this
                    var list = that.tableData.map(item => item.ZJID)
                    if (list.length == that.AddJYRWCList.length) {
                        that.AllListShow = true
                        console.log('394true', JSON.stringify(that.AllListShow))
                    }
                    else {
                        that.AllListShow = false
                        console.log('399fasle', JSON.stringify(that.AllListShow))
                    }
                    console.log('AddJYRWC_List', JSON.stringify(that.AddJYRWCList))
                },
                formatterDate(value) {
                    if (value) {
                        return value.split(' ')[0];
                    } else {
                        return value;
                    }
                },
                //查询日期控件
                clickDatePicker(row) {
                    vm.curDateObj = row;
                    vm.curDate = new Date(vm.formatterDate(vm.queryConditions[row.colName]));
                    vm.showDatePicker = true;
                },
                onDatePickerConfirm(values) {
                    //console.log(APP.getFormatDate(values[0]).split(' ')[0])
                    //console.log(APP.getFormatDate(values[1]).split(' ')[0])
                    vm.queryConditions[vm.curDateObj.colName] = APP.getFormatDate(values[0]).split(' ')[0] + '->' + APP.getFormatDate(values[1]).split(' ')[0];
                    vm.showDatePicker = false;
                    vm.curDateObj = '';
                    vm.curDat = '';
                    vm.showPopover = true;
                },
                onDatePickerCancel() {
                    vm.showDatePicker = false;
                    vm.curDateObj = '';
                    vm.curDat = '';
                    vm.showPopover = true;
                },
                //普通下拉筛选组件
                clickSelectPicker(row) {
                    vm.curSelectDataSource = JSLINQ(row.selDetail.sqlDataSource).select(function (item) {
                        return item[row.selDetail.displayValue]
                    }).ToArray();
                    //console.log(JSON.stringify(vm.curSelectDataSource));
                    vm.curSelectObj = row;
                    vm.curSelect = vm.queryConditions[row.colName + '_show'];
                    vm.showSelectPicker = true;
                },
                onSelectPickerConfirm(value, index) {
                    vm.queryConditions[vm.curSelectObj.colName] = vm.curSelectObj.selDetail.sqlDataSource[index][vm.curSelectObj.selDetail.hiddenValue];
                    vm.queryConditions[vm.curSelectObj.colName + '_show'] = vm.curSelectObj.selDetail.sqlDataSource[index][vm.curSelectObj.selDetail.hiddenValue];
                    vm.showSelectPicker = false;
                    vm.curSelectObj = '';
                    vm.curSelect = '';
                    vm.showPopover = true;
                },
                onSelectPickerCancel() {
                    vm.showSelectPicker = false;
                    vm.curSelectObj = '';
                    vm.curSelect = '';
                    vm.showPopover = true;
                },

                openLoading() {
                    $(".van-loading").show();
                    //this.isLoading = true;
                },
                closeLoading() {
                    $(".van-loading").hide();
                    //this.isLoading = false;
                },
                //表格数据配置
                tableConfig(options) {
                    console.log('options', JSON.stringify(options))
                    vm.columns = options.columns;
                    vm.workList = options.workList;
                    vm.crudList = options.crudList;
                    vm.params = options.params;
                    //vm.openLoading();
                    //初始化查询控件
                    var titleCols = JSLINQ(vm.columns).where(function (item) {
                        return item.isTitle == true
                    }).ToArray();
                    if (titleCols.length > 0) {
                        vm.titleCol = titleCols[0];
                    }
                    var keyName = "";
                    var keyValue = "";
                    var keyColumn = JSLINQ(vm.columns).where(function (item) { return item.isKey == true }).ToArray();
                    if (keyColumn.length > 0) {
                        vm.keyName = keyColumn[0].colName;
                    }

                    vm.initSelectValue();
                    var queryColumns = JSLINQ(vm.columns).where(function (item) {
                        return item.isColQuery == true && item.isTitle == false
                    }).ToArray();
                    vm.queryColumns = queryColumns;

                    vm.handleSizeChange();
                },
                //初始化下拉选择数据源
                initSelectValue() {
                    for (var i = 0; i < vm.columns.length; i++) {
                        //下拉控件
                        if (vm.columns[i].colType == 2) {
                            //普通下拉
                            if (vm.columns[i].selDetail.type == 1) {
                                var sql = vm.columns[i].selDetail.dataSource;
                                $.ajax({
                                    url: APP.serverIP() + "/SQLData/GetDataBySql",
                                    async: false,
                                    data: {
                                        sql: sql
                                    },
                                    type: "post",
                                    dataType: 'json',
                                    success: function (data) {
                                        if (data.status == 200) {
                                            vm.$set(vm.columns[i].selDetail, "sqlDataSource", data.data.ds);
                                            vm.$set(vm.columns[i].selDetail, "originDataSource", data.data.ds);
                                        }
                                    }
                                });
                            }
                        }
                    }
                },
                //初始化配置
                initConfig(objName) {
                    APP.ajax2('/AppFormList/GetDataByName', {
                        objName: objName
                    }, function (data) {

                        console.log(JSON.stringify(data));

                        // console.log(data.ds[0]["Id"])
                        console.log(data.ds[0]["columnsConfig"])
                        var filterCondition = data.ds[0]["filterCondition"];
                        if (filterCondition == null) {
                            filterCondition = "";
                        }
                        vm.tableConfig({
                            columns: JSON.parse(data.ds[0]["columnsConfig"]),
                            workList: JSON.parse(data.ds[0]["worksConfig"]),
                            crudList: JSON.parse(data.ds[0]["crudConfig"]),
                            params: {
                                isFormList: data.ds[0]["isFormList"],
                                physicalTableName: data.ds[0]["physicalTableName"],
                                isPaging: data.ds[0]["isPaging"],
                                filterCondition: filterCondition,
                                defaultOrder: data.ds[0]["defaultOrder"],
                                detailName: data.ds[0]["detailName"],
                                isFormEdit: false,
                                rowClassCol: data.ds[0]["rowClassCol"],
                                onReadyCallBack: data.ds[0]["onReadyCallBack"],
                                colClassCol: data.ds[0]["colClassCol"]
                            }
                        })
                    });
                },
                //搜索查询
                searchList() {
                    vm.paging.pageIndex = 1;
                    vm.showPopover = false;
                    vm.tableData = [];
                    setTimeout(function () {
                        vm.handleSizeChange();
                    }, 1000);

                },
                //分页事件
                handleSizeChange() {
                    vm.openLoading();
                    var queryColumns = [];
                    var filterCondition = ' 1=1 '
                    for (var i = 0; i < vm.queryColumns.length; i++) {
                        if (vm.queryConditions[vm.queryColumns[i].colName]) {
                            let colName = vm.queryColumns[i].colName;
                            //日期类型
                            if (vm.queryColumns[i].colType == 3) {
                                let dates = vm.queryConditions[colName].split('->');
                                filterCondition += ' and DATEDIFF(day, \'' + dates[0].toString() + '\',' + colName + ')>=0 and DATEDIFF(day, ' + colName + ', \'' + dates[1].toString() + '\')>=0  ';
                            }
                            else if (vm.queryColumns[i].colType == 2) {
                                filterCondition += ' and ' + colName + '=\'' + vm.queryConditions[colName] + '\' '
                            }
                            else if (vm.queryColumns[i].colType == 4) {
                                filterCondition += ' and ' + colName + '=\'' + vm.queryConditions[colName] + '\' '
                            }
                            else {
                                filterCondition += ' and ' + colName + ' like \'%' + vm.queryConditions[colName] + '%\' '
                            }
                        }
                    }
                    if (vm.queryConditions[vm.titleCol.colName]) {
                        filterCondition += ' and ' + vm.titleCol.colName + ' like \'%' + vm.queryConditions[vm.titleCol.colName] + '%\' '
                    }
                    if (vm.params.filterCondition) {
                        filterCondition += ' and ' + vm.params.filterCondition;
                    }
                    //查询
                    APP.ajax2('/SQLData/GetDataByPhysicalTableNameByQueryPaging', {
                        tableName: vm.params.physicalTableName,
                        columns: queryColumns,
                        currentCol: '',
                        pageIndex: vm.paging.pageIndex,
                        pageSize: vm.paging.pageSize,
                        isForm: vm.params.isFormList || true,
                        filterCondition: filterCondition,
                        defaultOrder: vm.params.defaultOrder || ''
                    }, function (data) {
                        vm.closeLoading();
                        vm.showListLoading = false;
                        if (vm.paging.pageIndex == 1) {
                            console.log('vm.tableData', JSON.stringify(data.ds))
                            vm.tableData = data.ds;
                        } else {
                            vm.tableData = vm.tableData.concat(data.ds);
                        }
                        for (var i = 0; i < vm.tableData.length; i++) {
                            vm.tableData[i].objNo = (i + 1).toString();
                            vm.tableData[i].show = false;
                        }
                        if (data.ds1.length > 0) {
                            //绑定总长度
                            vm.paging.totalCount = parseInt(data.ds1[0]["@TotalCount"]);
                            if (vm.tableData.length >= vm.paging.totalCount) {
                                vm.finished = true;
                            }
                            else {
                                vm.paging.pageIndex = vm.paging.pageIndex + 1;
                            }

                        }

                    }, function () {
                        vm.tableData = [];
                    });
                },
                clickItem(item) {
                    var that = this;

                    vm.keyValue = item[vm.keyName];
                    if (vm.titleName == '待审批') {
                        var pageParam = {
                            titleName: '',
                            historyData: item
                        }
                        item.BadReviewID = item.BillID
                        item.ReworkRepairID = item.BillID
                        item.LargeWorkID = item.BillID
                        item.MoldRequisitionID = item.BillID
                        item.LiabilityAccidentID = item.BillID
                        item.PollCheckID = item.ZJID
                        if (item.BillTypeName == '不合格评审单审批') {
                            pageParam.titleName = '不合格评审'
                            api.openWin({
                                name: 'unqualified',
                                url: 'unqualified.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: pageParam
                            })
                        }
                        else if (item.BillTypeName == '返工返修评审单审批') {
                            pageParam.titleName = '返工返修评审'
                            api.openWin({
                                name: 'ReturnFix',
                                url: 'ReturnFix.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: pageParam
                            })
                        }
                        else if (item.BillTypeName == '供应商质量单审批') {
                            pageParam.titleName = '供应商质量'
                            api.openWin({
                                name: 'SupplierQuality',
                                url: 'SupplierQuality.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: pageParam
                            })
                        }
                        else if (item.BillTypeName == '批量责任事故单审批') {
                            pageParam.titleName = '批量责任事故'
                            api.openWin({
                                name: 'VolumeAccident',
                                url: 'VolumeAccident.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: pageParam
                            })
                        }
                        else if (item.BillTypeName == '模具请购报废单审批') {
                            pageParam.titleName = '模具请购报废'
                            api.openWin({
                                name: 'scrapMoldApplication',
                                url: 'scrapMoldApplication.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: pageParam
                            })
                        }
                    }

                    if (vm.titleName == '未审核首件检' || vm.titleName == '已审核首件检') {
                        api.openWin({
                            name: 'firstInspection',
                            url: 'firstInspection.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName.includes('巡检')) {
                        api.openWin({
                            name: 'OnSiteInspection',
                            url: 'OnSiteInspection.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }

                    else if (vm.titleName == '补偿单报工') {
                        api.openWin({
                            name: 'compensationSheet',
                            url: 'compensationSheet.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '不合格评审') {
                        api.openWin({
                            name: 'unqualified',
                            url: 'unqualified.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '模具请购报废') {
                        api.openWin({
                            name: 'scrapMoldApplication',
                            url: 'scrapMoldApplication.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '返工返修评审') {
                        api.openWin({
                            name: 'ReturnFix',
                            url: 'ReturnFix.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '供应商质量') {
                        api.openWin({
                            name: 'SupplierQuality',
                            url: 'SupplierQuality.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '批量责任事故') {
                        api.openWin({
                            name: 'VolumeAccident',
                            url: 'VolumeAccident.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '成品入库检') {
                        api.openWin({
                            name: 'ProductWarehousInspection',
                            url: 'ProductWarehousInspection.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }
                    else if (vm.titleName == '到货单') {
                        api.openWin({
                            name: 'ArrivalOrder',
                            url: 'ArrivalOrder.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }

                        })
                    }
                    else if (vm.titleName == '检验任务池') {
                        if (item.JYLX.includes('巡检')) {
                            item.PollCheckID = item.ZJID
                            console.log(JSON.stringify(item))
                            api.openWin({
                                name: 'OnSiteInspection',
                                url: 'OnSiteInspection.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: {
                                    titleName: api.pageParam.titleName,
                                    historyData: item,
                                }
                            })
                        }



                        //                 if (vm.titleName == '未审核巡检') {
                        //     api.openWin({
                        //         name: 'OnSiteInspection',
                        //         url: 'OnSiteInspection.html',
                        //         reload: true,
                        //         slidBackEnabled: false,
                        //         pageParam: {
                        //             titleName: api.pageParam.titleName,
                        //         }
                        //     })
                        // }

                        // else if (vm.titleName == '已审核巡检') {
                        //     api.openWin({
                        //         name: 'OnSiteInspection',
                        //         url: 'OnSiteInspection.html',
                        //         reload: true,
                        //         slidBackEnabled: false,
                        //         pageParam: {
                        //             titleName: api.pageParam.titleName,
                        //         }
                        //     })
                        // }
                        else if (item.JYLX == '成品检') {
                            api.openWin({
                                name: 'ProductWarehousInspection',
                                url: 'ProductWarehousInspection.html',
                                reload: true,
                                slidBackEnabled: false,
                                pageParam: {
                                    titleName: api.pageParam.titleName,
                                    historyData: item
                                }
                            })
                        }


                    }
                    else {
                        api.openWin({
                            name: 'FormIndex',
                            url: 'Index.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                moduleName: vm.params.detailName,
                                titleName: api.pageParam.titleName,
                                keyName: vm.keyName,
                                keyValue: vm.keyValue
                            }
                        })
                    }

                    // }

                },
                insertNew() {


                    if (vm.titleName.includes('巡检')) {
                        api.openWin({
                            name: 'OnSiteInspection',
                            url: 'OnSiteInspection.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    }

                    // else if (vm.titleName == '已审核巡检') {
                    //     api.openWin({
                    //         name: 'OnSiteInspection',
                    //         url: 'OnSiteInspection.html',
                    //         reload: true,
                    //         slidBackEnabled: false,
                    //         pageParam: {
                    //             titleName: api.pageParam.titleName,
                    //         }
                    //     })
                    // }
                    //  else if (vm.titleName == '大工单' || vm.titleName == '杂工单') {
                    //     api.openWin({
                    //         name: 'largeWorkOrder',
                    //         url: 'largeWorkOrder.html',
                    //         reload: true,
                    //         slidBackEnabled: false,
                    //         pageParam: {
                    //             titleName: api.pageParam.titleName
                    //         }
                    //     })
                    // }
                    // else if (vm.titleName == '来料检' || vm.titleName == '已检验来料检') {
                    //     api.openWin({
                    //         name: 'incomingInspection',
                    //         url: 'incomingInspection.html',
                    //         reload: true,
                    //         slidBackEnabled: false,
                    //         pageParam: {
                    //             titleName: api.pageParam.titleName
                    //         }
                    //     })
                    // }
                    else if (vm.titleName == '补偿单报工') {
                        api.openWin({
                            name: 'compensationSheet',
                            url: 'compensationSheet.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    } else if (vm.titleName == '模具请购报废') {
                        api.openWin({
                            name: 'scrapMoldApplication',
                            url: 'scrapMoldApplication.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    } else if (vm.titleName == '返工返修评审') {
                        api.openWin({
                            name: 'ReturnFix',
                            url: 'ReturnFix.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    } else if (vm.titleName == '供应商质量') {
                        api.openWin({
                            name: 'SupplierQuality',
                            url: 'SupplierQuality.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    } else if (vm.titleName == '批量责任事故') {
                        api.openWin({
                            name: 'VolumeAccident',
                            url: 'VolumeAccident.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    }
                    else if (vm.titleName == '不合格评审') {
                        api.openWin({
                            name: 'unqualified',
                            url: 'unqualified.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                            }
                        })
                    }
                    else if (vm.titleName == '检验任务池') {
                        api.openWin({
                            name: 'firstInspection',
                            url: 'firstInspection.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                titleName: api.pageParam.titleName,
                                historyData: item
                            }
                        })
                    }

                    else {
                        api.openWin({
                            name: 'FormIndex',
                            url: 'Index.html',
                            reload: true,
                            slidBackEnabled: false,
                            pageParam: {
                                moduleName: vm.params.detailName,
                                titleName: api.pageParam.titleName,
                                keyName: vm.keyName,
                                keyValue: 0
                            }
                        })
                    }
                },
                onClickLeft: function () {
                    // api.setScreenOrientation({
                    //     orientation: 'portrait_up'
                    // })
                    api.closeWin();
                }
            }
        });
    }
</script>